package com.example.login

import android.content.Context
import android.database.sqlite.SQLiteDatabase
import android.database.sqlite.SQLiteOpenHelper

class DBHelper(context: Context?, name: String?, factory: SQLiteDatabase.CursorFactory?, version: Int) :
    SQLiteOpenHelper(context, name, factory, version) {
    override fun onCreate(db: SQLiteDatabase) {
        //创建一个表
        var SQLstr = "create table userInfo(uname text,psw text)"
        db.execSQL(SQLstr)
        //往表里边插入一个数据
        SQLstr = "insert into userInfo(uname,psw) values('admin','123456')"
        db.execSQL(SQLstr)
    }

    override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {}
}